<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // const arr = [100, 60, 80]
    // // const max = arr[0]
    // // const min = arr[1]
    // // const avg = arr[2]

    // // 数组解构 赋值
    // const [max, min, avg] = arr
    // console.log(max);
    // console.log(min);
    // console.log(avg);

    // // 交换2个变量的值
    // let a = 1
    // let b = 2;
    // [b, a] = [a, b]
    // console.log(b, a);



    // 案例
    const pc = ['海尔', '联想', '小米', '方正']

    const [hr, lx, mi, fz] = pc
    console.log(hr);
    console.log(lx);
    console.log(mi);
    console.log(fz);

    function getValue() {
      return [100, 60]
    }
    const arr = getValue()
    const [num, num2] = arr
    console.log(num);
    console.log(num2);
  </script>
</body>

</html>